from typing import List
def pivotIndex(nums: List[int]) -> int:
    sum_left,sum_right =0,sum(nums)
    for i in range(len(nums)):
        sum_right -= nums[i]
        if sum_left == sum_right:
            return i 
        sum_left += nums[i]
    return -1 